package com.itheima.duotai3;

/*
多态的成员方法
 */
public class Test {
    public static void main(String[] args) {
        Fu fu = new Zi();
        fu.sing();//运行看右边
        fu.dance();//运行看右边
        //fu.rap();编译看左边
    }
}
class Fu {
    public Fu(){
        System.out.println("父类的构造");
    }
    public void sing() {
        System.out.println("父的sing");
    }
    public void dance() {
        System.out.println("父的dance");
    }
}
class Zi extends Fu {
    public Zi(){
        super();
        System.out.println("子类的构造");
    }
    @Override
    public void sing() {
        System.out.println("子的sing");
    }
    public void rap() {
        System.out.println("子类独有rap");
    }
}
